package com.dianping.cat.consumer.all.config.transform;
import com.dianping.cat.consumer.all.config.entity.AllConfig;
import com.dianping.cat.consumer.all.config.entity.Name;
import com.dianping.cat.consumer.all.config.entity.Report;
import com.dianping.cat.consumer.all.config.entity.Type;
import java.util.ArrayList;
import java.util.List;

public class DefaultLinker implements ILinker {
  private boolean m_deferrable;

  public DefaultLinker(boolean deferrable) {
/* 13 */     this.m_deferedJobs = new ArrayList();


/* 16 */     this.m_deferrable = deferrable;
  }
  private List<Runnable> m_deferedJobs;
  public void finish() {
/* 20 */     for (Runnable job : this.m_deferedJobs) {
/* 21 */       job.run();
    }
  }


  public boolean onName(Type parent, Name name) {
/* 27 */     parent.addName(name);
/* 28 */     return true;
  }


  public boolean onReport(final AllConfig parent, final Report report) {
/* 33 */     if (this.m_deferrable) {
/* 34 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 37 */               parent.addReport(report);
            }
          });
    } else {
/* 41 */       parent.addReport(report);
    }

/* 44 */     return true;
  }


  public boolean onType(final Report parent, final Type type) {
/* 49 */     if (this.m_deferrable) {
/* 50 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 53 */               parent.addType(type);
            }
          });
    } else {
/* 57 */       parent.addType(type);
    }

/* 60 */     return true;
  }
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/lib/cat-consumer-3.0.0.jar!/com/dianping/cat/consumer/all/config/transform/DefaultLinker.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */